package com.elink.enginerring.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.elink.enginerring.co.BaseCo;
import com.elink.enginerring.co.PostbarCo;
import com.elink.enginerring.domain.Postbar;
import com.elink.enginerring.vo.CategoryListOfHier;
import com.elink.enginerring.vo.CategoryListOfInternal;
import com.elink.enginerring.vo.PostBarOfRelevantVo;
import com.elink.enginerring.vo.PostbarVo;

public interface PostbarMapper {

	int deleteByPrimaryKey(String postbarId);

    int insert(Postbar record);

    int insertSelective(Postbar record);

    Postbar selectByPrimaryKey(String postbarId);

    int updateByPrimaryKeySelective(Postbar record);

    int updateByPrimaryKeyWithBLOBs(Postbar record);

    int updateByPrimaryKey(Postbar record);
    
    Postbar selectByUserId(@Param("postbarId")String postbarId,@Param("userId")String userId);
    
	List<Postbar> selectList(@Param("co")PostbarCo co);

	int selectCount(@Param("co")PostbarCo co);
	
    PostbarVo getInfo(@Param("pbId")String pbId,@Param("userId")String userId);
    
	List<Postbar> selecHotPostbar(@Param("count")int count);

	List<Postbar> getPostbarById(@Param("co")BaseCo co, @Param("userId")String userId);
	
	int selectCountOfPostbarById(@Param("userId")String userId);

	@Select("update  post_bar set close_status = 1 where postbar_id= #{courseId}")
	void updatePostbar(@Param("courseId")String courseId);

	List<Postbar> getMyCollect(@Param("co")BaseCo co, @Param("userId")String userId);

	int  selectCountMyCollect(@Param("userId")String userId);

	List<PostBarOfRelevantVo> getRelevant(@Param("dcId")String dcId,@Param("count")int count);

	List<CategoryListOfInternal> selectPostbarListOfInternalCategory(@Param("scId")int scId);
	
	List<CategoryListOfHier> selectPostbarListOfHier(@Param("hierId")int hierId);
	
	List<Map<String, Object>> selectSum();

	List<Postbar> selectPostbarOfIndex(@Param("count")int count);
	
	List<PostBarOfRelevantVo> selectPostbarRank(@Param("count")int count);
	
	List<Postbar>  selectListReplyByUserId(@Param("co")BaseCo co, @Param("userId")String userId);

	int  selectCountReplyByUserId(@Param("userId")String userId);

	List<Postbar> selectListByKeyWord(@Param("co")BaseCo co, @Param("labelIds")String labelIds,@Param("replyCount")Boolean replyCount,@Param("time")Boolean time);

	int  selectCountByKeyWord(@Param("labelIds")String labelIds,@Param("replyCount")Boolean replyCount,@Param("time")Boolean time );
}